package com.zwl.dao.impl;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.zwl.dao.BaseDao;
import com.zwl.dao.DeptDao;
import com.zwl.po.DeptPo;

public class DeptDaoImpl extends BaseDao<DeptPo> implements DeptDao {

	@Override
	public List<DeptPo> findByCondition(Map<String, Object> map) {
		List<Object> paramList=new ArrayList<>();
		StringBuffer sf=new StringBuffer();
		sf.append(" select * from b_dept where 1=1 ");
		if(map!=null && map.size()>0){
			if(map.get("isActive")!=null){
				sf.append(" and is_active=?");
				paramList.add(map.get("isActive"));
			}
		}
		
		return this.executeQuery3(sf.toString(), null, DeptPo.class, paramList.toArray());
	}

	@Override
	public DeptPo findbyId(Integer id) {
		List<Object> paramList=new ArrayList<>();
		String sql=" select * from b_dept where id=? ";
		paramList.add(id);
		
		List<DeptPo> list=this.executeQuery3(sql, null, DeptPo.class, paramList.toArray());
		return (list!=null && list.size()>0)?list.get(0):null;
	}



	@Override
	public DeptPo getEntity(ResultSet rs) {
		return null;
	}

}
